9d87951efd8f728665837aba4211e6192e574b75,plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathReader.java,EclipseClasspathReader,readClasspathEntry,#ModifiableRootModel#Collection#Collection#Set#Set#String#Element#number#,136

Before Change



      final String sourcePath = element.getAttributeValue(EclipseXml.SOURCEPATH_ATTR);
      if (sourcePath != null) {
        final String srcUrl = expandEclipsePath2Url(sourcePath, rootModel, myCurrentRoots);
        modifiableModel.addRoot(srcUrl, OrderRootType.SOURCES);
      }

After Change


    }
  }

  private void readClasspathEntry(ModifiableRootModel rootModel,
                                  final Collection<String> unknownLibraries,
                                  Collection<String> unknownJdks,
                                  final Set<String> usedVariables,
                                  Set<String> refsToModules,
                                  final String testPattern,
                                  Element element, int idx) throws ConversionException {
    String kind = element.getAttributeValue(EclipseXml.KIND_ATTR);
    if (kind == null) {
      throw new ConversionException("Missing classpathentry/@kind");
    }


    String path = element.getAttributeValue(EclipseXml.PATH_ATTR);
    if (path == null) {
      throw new ConversionException("Missing classpathentry/@path");
    }

    final boolean exported = EclipseXml.TRUE_VALUE.equals(element.getAttributeValue(EclipseXml.EXPORTED_ATTR));

    final EclipseModuleManager eclipseModuleManager = EclipseModuleManager.getInstance(rootModel.getModule());
    if (kind.equals(EclipseXml.SRC_KIND)) {
      if (path.startsWith("/")) {
        final String moduleName = path.substring(1);
        refsToModules.add(moduleName);
        rootModel.addInvalidModuleEntry(moduleName).setExported(exported);
      }
      else {
        String srcUrl = VfsUtil.pathToUrl(myRootPath + "/" + path);
        boolean isTestFolder = false;
        try {
          isTestFolder = testPattern != null && testPattern.length() > 0 && path.matches(testPattern);
        }
        catch (PatternSyntaxException e) {
          isTestFolder = false;
        }
        final String linked = expandLinkedResourcesPath(rootModel, usedVariables, path);
        if (linked != null) {
          srcUrl = VfsUtil.pathToUrl(linked);
          eclipseModuleManager.registerEclipseLinkedSrcVarPath(srcUrl, path);
          rootModel.addContentEntry(srcUrl).addSourceFolder(srcUrl, isTestFolder);
        } else {
          getContentEntry().addSourceFolder(srcUrl, isTestFolder);
        }
        eclipseModuleManager.setExpectedModuleSourcePlace(rearrangeOrderEntryOfType(rootModel, ModuleSourceOrderEntry.class));
        eclipseModuleManager.registerSrcPlace(srcUrl, idx);
      }
    }

    else if (kind.equals(EclipseXml.OUTPUT_KIND)) {
      String output = myRootPath + "/" + path;
      final String linked = expandLinkedResourcesPath(rootModel, usedVariables, path);
      if (linked != null) {
        output = linked;
        eclipseModuleManager.registerEclipseLinkedVarPath(VfsUtil.pathToUrl(output), path);
      }
      setupOutput(rootModel, output);
    }

    else if (kind.equals(EclipseXml.LIB_KIND)) {
      final String libName = getPresentableName(path);
      final Library library = rootModel.getModuleLibraryTable().getModifiableModel().createLibrary(libName);
      final Library.ModifiableModel modifiableModel = library.getModifiableModel();

      final String linked = expandLinkedResourcesPath(rootModel, usedVariables, path);
      final String url;
      if (linked != null) {
        url = VfsUtil.pathToUrl(linked);
        eclipseModuleManager.registerEclipseLinkedVarPath(url, path);
      } else {
        url = expandEclipsePath2Url(path, rootModel, myCurrentRoots);
      }
      modifiableModel.addRoot(url, OrderRootType.CLASSES);
      eclipseModuleManager.registerEclipseLibUrl(url);

      final String sourcePath = element.getAttributeValue(EclipseXml.SOURCEPATH_ATTR);
      if (sourcePath != null) {
        final String linkedSrc = expandLinkedResourcesPath(rootModel, usedVariables, sourcePath);
        final String srcUrl;
        if (linkedSrc != null) {
          srcUrl = VfsUtil.pathToUrl(linkedSrc);
          eclipseModuleManager.registerEclipseLinkedSrcVarPath(srcUrl, sourcePath);
        }
        else {
          srcUrl = expandEclipsePath2Url(sourcePath, rootModel, myCurrentRoots);
        }
        modifiableModel.addRoot(srcUrl, OrderRootType.SOURCES);
      }